package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 逻辑删除枚举
 *
 * @author helong
*/
@Getter
public enum IsDeleteEnum {

    NOT_DELETE("未删除", 0),
    DELETE("已删除", 1);

    private final String text;

    private final Integer value;

    IsDeleteEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static IsDeleteEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (IsDeleteEnum isDeleteEnum : IsDeleteEnum.values()) {
            if (isDeleteEnum.getValue().equals(value)) {
                return isDeleteEnum;
            }
        }
        return null;
    }



}